package com.demo.servlet.demo1208;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;

//注解开发Servlet
//url-pattern 的内容直接写在注解当中
@WebServlet("/demo02.do")
public class Demo02Servlet implements Servlet {
    public Demo02Servlet() {
        System.out.println("Demo02Servlet 的 无参构造函数");
    }

    @Override
    public void init(ServletConfig config) throws ServletException {
        //Servlet 初始化方法
        System.out.println("Demo02Servlet 的 init()");
    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        System.out.println("Demo02Servlet 的 service()");
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {
        System.out.println("Demo02Servlet 被摧毁");
    }
}
